﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Strom.Server.Commands
{
    class ListAccountCommand : BaseCommand, IConsoleCommand
    {
        public void ExecuteWithParameters(string[] parameters)
        {
            if(parameters.Length != 0)
            {
                InvalidParameters();
                return;
            }

            lock (ServerDatas.Server.Database.AccountsList)
            {
                Console.WriteLine("\t{0} comptes enregistré(s):", ServerDatas.Server.Database.AccountsList.Count);

                foreach (var account in ServerDatas.Server.Database.AccountsList)
                    Console.WriteLine("\t[Login:{0}]", account.Infos.Login);
            }
        }

        public static string CommandName
        {
            get { return "acc_list"; }
        }
    }
}
